// import * as path from "path";
// import {defineConfig} from 'vitepress'
import { withMermaid } from "vitepress-plugin-mermaid";

const BLOG_TITLE = "编程错题集"

// https://vitepress.dev/reference/site-config
export default withMermaid({
  // 基础配置
  srcDir: "./docs",  // 配置 Markdown 源文件所在的根目录

  // 首页配置
  title: BLOG_TITLE,
  description: "记录常见开发当中的各种问题",
  head: [
    ['link', {rel: "icon", href: "./iconfont"}]
  ],


  // 主题相关配置
  themeConfig: {
    logo: "/asset/vue.svg",
    siteTitle: BLOG_TITLE,  // 更改站点导航栏标题
    nav: [
      {
        text: '首页',
        link: '/'
      },
      {
        text: '语言/框架',
        items: [
          {text: "Golang", link: "/language/golang/"},
          // {text: "Python", link: "/language/python/"},
          // {text: "Shell", link: "/language/shell/"},
          // {text: "Javascript", link: "/language/js/"},
          // {text: "Typescript", link: "/language/ts/"},
          // {text: "HTML/CSS", link: "/language/html-css/"},
          // {text: "Vue3", link: "/language/vue3/"},
          // {text: "Uniapp", link: "/language/uniapp/"},
        ]
      },
      // {
      //   text: '工具/中间件',
      //   items: [
      //     {text: "Docker", link: "/tool/docker/"},
      //     {text: "Nginx", link: "/tool/nginx/"},
      //     {text: "缓存", link: "/tool/cache/"},
      //     {text: "搜索", link: "/tool/search/"},
      //     {text: "数据库", link: "/tool/database/"},
      //     {text: "注册中心", link: "/tool/registration/"},
      //     {text: "消息队列", link: "/tool/message-queue/"},
      //     {text: "监控告警", link: "/tool/monitor/"},
      //     {text: "Jenkins", link: "/tool/jenkins/"},
      //   ]
      // },
      // {
      //   text: '案例实战',
      //   items: [
      //     {text: 'TodoList 待办列表', link: '/project/todo-list/'},
      //     {text: '秒杀系统', link: '/project/flash-sale/'},
      //   ]
      // },
      {
        text: '其它总结',
        items: [
          // {text: 'Vitepress', link: '/summary/vitepress/'},
          // {text: 'SEO', link: '/summary/seo/'},
          // {text: 'Linux', link: '/summary/linux/'},
          // {text: '常见算法', link: '/summary/algorithm/'},
          // {text: '编程范式', link: '/summary/programming-paradigm/'},
          // {text: '设计原则', link: '/summary/solid/'},
          {text: '设计模式', link: '/design/'},
          // {text: '整洁架构', link: '/summary/clean/'},
          // {text: '领域驱动', link: '/summary/ddd/'},
        ]
      },
    ],

    // 网站内容页侧边栏
    // sidebar: [], // 基础使用
    sidebar: {
      // 语言/框架
      "/language/golang/": [
        {
          text: 'Golang语言',
          items: [
            {
              text: "环境搭建",
              collapsed: false,
              items: [
                // {text: "windows环境搭建", link: "/language/golang/env_win"},
                {text: "linux环境搭建", link: "/language/golang/env_linux"},
              ],
            },
            // {
            //   text: "Web框架",
            //   collapsed: false,
            //   items: [
            //     {text: "Gin", link: "/language/golang/web_gin"},
            //     {text: "Mux", link: "/language/golang/web_mux"},
            //     {text: "Echo", link: "/language/golang/web_echo"},
            //   ]
            // },
            // {
            //   text: "ORM框架",
            //   collapsed: false,
            //   items: [
            //     {
            //       text: "GORM",
            //       collapsed: false,
            //       items: [
            //         {text: '连接封装', link: "/language/golang/gorm/connect"},
            //         {text: '简单封装', link: "/language/golang/gorm/encapsulation"},
            //         {text: 'CRUD操作', link: "/language/golang/gorm/crud"},
            //       ]
            //     },
            //   ]
            // },
            // {
            //   text: '项目架构',
            //   collapsed: false,
            //   items: [
            //     {text: '单体MVC', link: '/language/golang/architecture/mvc'},
            //     {text: '微服务', link: '/language/golang/architecture/microservices'},
            //   ]
            // },
          ]
        },
      ],
      // "/language/python/": [
      //   {
      //     text: 'Python语言',
      //     items: []
      //   }
      // ],
      // "/language/shell/": [
      //   {
      //     text: 'Shell脚本',
      //     items: []
      //   }
      // ],
      // "/language/js/": [
      //   {
      //     text: 'Javascript语言',
      //     items: []
      //   }
      // ],
      // "/language/ts/": [
      //   {
      //     text: 'Typescript语言',
      //     items: []
      //   }
      // ],
      // "/language/html-css/": [
      //   {
      //     text: '前端HTML/CSS',
      //     items: []
      //   }
      // ],
      // "/language/vue3/": [
      //   {
      //     text: 'Vue3框架',
      //     items: []
      //   }
      // ],
      // "/language/uniapp/": [
      //   {
      //     text: 'Uniapp目录',
      //     items: []
      //   }
      // ],

      // // 工具/中间件
      // '/tool/docker/': [
      //   {
      //     text: 'Docker目录',
      //     items: []
      //   }
      // ],
      // '/tool/nginx/': [
      //   {
      //     text: 'Nginx目录',
      //     items: []
      //   }
      // ],
      // '/tool/cache/': [
      //   {
      //     text: '缓存',
      //     items: [
      //       {text: "Redis", link: "/tool/cache/redis/"},
      //     ]
      //   }
      // ],
      // '/tool/search/': [
      //   {
      //     text: '搜索',
      //     items: [
      //       {text: "Elasticsearch", link: "/tool/search/elasticsearch/"},
      //       {text: "RedisSearch", link: "/tool/search/redis-search/"},
      //     ]
      //   }
      // ],
      // '/tool/database/': [
      //   {
      //     text: '数据库',
      //     items: [
      //       {text: "MySQL", link: "/tool/database/mysql/"},
      //       {text: "PostgresSQL", link: "/tool/database/postgres/"},
      //       {text: "MongoDB", link: "/tool/database/mongodb/"},
      //     ]
      //   }
      // ],
      // '/tool/registration/': [
      //   {
      //     text: '注册中心',
      //     items: [
      //       {text: "Etcd", link: "/tool/registration/etcd/"},
      //       {text: "Consul", link: "/tool/registration/consul/"},
      //     ]
      //   }
      // ],
      //
      // '/tool/message-queue/': [
      //   {
      //     text: '消息队列',
      //     items: [
      //       {text: "Kafka", link: "/tool/message-queue/kafka/"},
      //       {text: "RocketMQ", link: "/tool/message-queue/rocketmq/"},
      //     ]
      //   }
      // ],
      // '/tool/monitor/': [
      //   {
      //     text: '监控告警',
      //     items: [
      //       {text: "Prometheus", link: "/tool/monitor/prometheus/"},
      //     ]
      //   }
      // ],
      //
      // '/tool/jenkins/': [
      //   {
      //     text: 'Jenkins',
      //     items: []
      //   }
      // ],
      //
      // 常用设计模式
      '/design/': [
        {
          text: '设计模式分类',
          items: [
            // {
            //   text: '创建型',
            //   items: [
            //     {text: '单例模式', link: '/design/singleton'},
            //     {text: '工厂方法模式', link: '/design/factory-method'},
            //     {text: '抽象工厂模式', link: '/design/abstract-factory'},
            //     {text: '建造者模式', link: '/design/builder'},
            //     // {text: '原型模式', link: '/design/prototype/'},
            //   ]
            // },
            // {
            //   text: '结构型',
            //   items: [
            //     {text: '适配器模式', link: '/design/adapter'},
            //     // {text: '桥接模式', link: '/design/bridge'},
            //     // {text: '组合模式', link: '/design/composite'},
            //     {text: '装饰器模式', link: '/design/decorator'},
            //     // {text: '外观模式', link: '/design/facade'},
            //     // {text: '享元模式', link: '/design/flyweight'},
            //     {text: '代理模式', link: '/design/proxy'},
            //   ]
            // },
            {
              text: '行为型',
              items: [
                {text: '责任链模式', link: '/design/chain-of-responsibility'},
                // // {text: '命令模式', link: '/design/command'},
                // {text: '迭代器模式', link: '/design/iterator'},
                // // {text: '中介者模式', link: '/design/mediator'},
                // // {text: '备忘录模式', link: '/design/memento'},
                // {text: '观察者模式', link: '/design/observer'},
                // // {text: '状态模式', link: '/design/state'},
                // {text: '策略模式', link: '/design/strategy'},
                // {text: '模板方法模式', link: '/design/template-method'},
                // {text: '访问者模式', link: '/design/visitor'},
              ]
            },
          ]
        }
      ],
      //
      // // 案例实战
      // '/project/todo-list/': [
      //   {
      //     text: 'TodoList 待办列表',
      //     items: []
      //   }
      // ],
      // '/project/flash-sale/': [
      //   {
      //     text: '秒杀系统',
      //     items: []
      //   }
      // ],
      //
      // // 其它总结
      // '/summary/vitepress/': [
      //   {
      //     text: 'Vitepress建站',
      //     items: []
      //   }
      // ],
      // '/summary/linux/': [
      //   {
      //     text: 'Linux操作',
      //     items: [
      //       {text:"Debian12系统初始配置", link: "/summary/linux/debian12-system-init"}
      //     ]
      //   }
      // ],
      // '/summary/algorithm/': [
      //   {
      //     text: '常用算法',
      //     items: []
      //   }
      // ],
      // '/summary/programming-paradigm/': [
      //   {
      //     text: '编程范式',
      //     items: []
      //   }
      // ],
      // '/summary/solid/': [
      //   {
      //     text: '设计原则',
      //     items: []
      //   }
      // ],
      // '/summary/clean/': [
      //   {
      //     text: '整洁架构',
      //     items: []
      //   }
      // ],
      // '/summary/ddd/': [
      //   {
      //     text: '领域驱动',
      //     items: []
      //   }
      // ],
    },

    // author: "",
    outline: {
      label: "目录",
      level: [2, 3]
    },

    // 社交关联链接
    // socialLinks: [
    //   {
    //     link: 'https://github.com/wplbyx',
    //     ariaLabel: 'wechat link',
    //     icon: {
    //       svg: '<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1716780999138" class="icon" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2602" xmlns:xlink="http://www.w3.org/1999/xlink" width="200.1953125" height="200"><path d="M1024.16 694.816c0-149.92-143.104-271.392-319.584-271.392-176.576 0-319.68 121.504-319.68 271.392S528 966.208 704.576 966.208c55.456 0 107.648-12.096 153.184-33.248l125.984 54.528-14.592-140.544c34.784-43.392 55.04-95.808 55.04-152.128zM596.832 621.28c-25.152 0-45.472-20.352-45.472-45.472s20.32-45.472 45.472-45.472c25.12 0 45.44 20.384 45.44 45.472s-20.384 45.472-45.44 45.472z m215.392 0c-25.056 0-45.44-20.352-45.44-45.472s20.384-45.472 45.44-45.472c25.184 0 45.536 20.384 45.536 45.472s-20.352 45.472-45.536 45.472zM704.576 387.488c49.376 0 96.416 8.8 139.264 24.64 0.32-5.728 0.992-11.232 0.992-16.992 0-198.08-189.152-358.624-422.432-358.624C189.184 36.512 0.032 197.024 0.032 395.136c0 74.496 26.816 143.776 72.704 201.12L53.472 781.92l166.432-72.096c41.216 19.2 86.784 32.16 134.88 38.784-3.616-17.504-5.824-35.424-5.824-53.792 0.032-169.44 159.552-307.296 355.616-307.296z m-139.808-209.6c33.184 0 60 26.88 60 60 0 33.184-26.816 60.064-60 60.064s-60.032-26.88-60.032-60.064c0-33.152 26.88-60 60.032-60zM280.032 297.952c-33.184 0-60-26.88-60-60.064 0-33.152 26.848-60 60-60 33.184 0 60.032 26.88 60.032 60s-26.88 60.064-60.032 60.064z" fill="#51C332" p-id="2603"></path></svg>'
    //     }
    //   }
    // ],


    // 底部版权信息
    footer: {
      // message: 'License.',
      copyright: '备案号：蜀ICP备2024080827号-1' // https://beian.miit.gov.cn/#/Integrated/index
    },

    // 本地全文搜索
    search: {
      // provider: "local",
    },

    lastUpdated: {
      text: '上次更新时间',
      formatOptions: {
        year: "numeric",
        month: "numeric",
        day: "numeric",
        hour: "2-digit",
        minute: "2-digit",
        second: "2-digit"
      }
    },
    docFooter: {
      prev: '上一页',
      next: '下一页'
    },

    sidebarMenuLabel: ""
  },

  // markdown相关配置
  markdown: {
    image: {
      lazyLoading: true,  // 启用markdown图片懒加载
    },
    container: {},
  },

  locales: {
    en: {
      label: "English",
      lang: "en",
      link: "/docs/en",
    },
    zh: {
      label: "简体中文",
      lang: "zh",
      link: "/docs/zh",
    }
  },

  lastUpdated: true,  // 启用显示更新时间


  vite: {
    // plugins: [
    //
    // ],
    // server: {
    //   hmr: {
    //     overlay: false
    //   }
    // }
  }
})
